package com.linln.modules.order.domain;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.annotation.*;

import java.math.BigDecimal;
import java.util.Map;

import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;


/**
 * @author : pengliang
 * @version V1.0
 * @Project: timo
 * @Package com.linln.modules.order.domain
 * @Descriptio /**
 * @Project: timo
 * @Package com.linln.modules.order.domain
 * @Description: TODO
 * @date Date : 2020年12月25日 16:37
 */

@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "tbl_order")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Order {
    /**
     * 订单id
     */
    @TableId(value = "order_id", type = IdType.UUID)
    private String orderId;

    /**
     * 店铺服务id
     */
    @TableField(value = "shop_service_id")
    private String shopServiceId;

    /**
     * 积分商城服务id
     */
    @TableField(value = "integral_mall_service_id")
    private String integralMallServiceId;

    /**
     * 服务名称
     */
    @TableField(value = "service_name", exist = false)
    private String serviceName;

    /**
     * 订单号码
     */
    @TableField(value = "order_number")
    private String orderNumber;

    /**
     * 下单时间
     */
    @TableField(value = "order_time")
    private String orderTime;

    /**
     * 订单金额
     */
    @TableField(value = "order_money")
    private Double orderMoney;

    /**
     * 实际付款金额
     */
    @TableField(value = "actual_pay_money")
    private Double actualPayMoney;

    /**
     * 使用积分数量
     */
    @TableField(value = "integral_use_count")
    private Integer integralUseCount;

    /**
     * 支付时间
     */
    @TableField(value = "pay_time")
    private String payTime;

    /**
     * 支付方式 0金额 1积分 2积分加金额
     */
    @TableField(value = "pay_mode")
    private Integer payMode;

    /**
     * 订单状态 0待支付 1已完成
     */
    @TableField(value = "order_status")
    private String orderStatus;

    /**
     * 订单扩展属性
     */
    @TableField(value = "order_properties")
    @JsonIgnore
    private String orderProperties;

    //序列化这个方法
    @JsonGetter("orderProperties")
    public Map getArticlePropsMap() {
        return JSON.parseObject(orderProperties, Map.class);
    }

    /**
     * 用户id
     */
    @TableField(value = "user_id")
    private long userId;
    /**
     * 用户名称
     */
    @TableField(value = "user_name",exist = false)
    private String userName;
    /**
     * 使用说明
     */
    @TableField(value = "use_explain")
    private String useExplain;

    /**
     * 逻辑删除
     */
    @TableLogic
    @TableField(value = "del_flag")
    private Integer delFlag;


    public static final String COL_ORDER_ID = "order_id";

    public static final String COL_SHOP_SERVICE_ID = "shop_service_id";

    public static final String COL_INTEGRAL_MALL_SERVICE_ID = "integral_mall_service_id";

    public static final String COL_ORDER_NUMBER = "order_number";

    public static final String COL_ORDER_TIME = "order_time";

    public static final String COL_ORDER_MONEY = "order_money";

    public static final String COL_ACTUAL_PAY_MONEY = "actual_pay_money";

    public static final String COL_INTEGRAL_USE_COUNT = "integral_use_count";

    public static final String COL_PAY_TIME = "pay_time";

    public static final String COL_PAY_MODE = "pay_mode";

    public static final String COL_ORDER_STATUS = "order_status";

    public static final String COL_ORDER_PROPERTIES = "order_properties";

    public static final String COL_USER_ID = "user_id";
}
